home *** CD-ROM | disk | FTP | other *** search
Text File | 2000-02-20 | 4.1 KB | 132 lines | [TEXT/R*ch] |
- (c) 2000 Peter Li, All Rights Reserved.
- =======================================
-
-
- This module provides some routines that are mostly specific to MacICI (MICI).
-
-
- Standard Lib Routines
- =====================
-
- LoadModuleConstants();
-
- Description: Loads constants used by MICI Module to make scripts
- more readable.
- Parameters: none
- Returns: null
-
- -----------------------------
-
- GetModuleVersion();
-
- Description: Returns the version of this module.
- Parameters: none
- Returns: null
-
-
-
- MICI Routines
- =============
-
- Alert(int inAlertType, string inAlertText);
-
- Description: This puts up a standard alert to the user.
- Parameters: inAlertType - type of alert:
- STOPALERT = 0 => Stop Alert
- NOTEALERT = 1 => Note Alert
- CAUTIONALERT = 2 => Caution Alert
- inAlertText - text to appear in alert.
- Returns: null
-
- Example: MICI.Alert(STOPALERT, "Disk is full.");
-
- -----------------------------
-
- int = Ask(string inQuestion, string inDefaultAnswer, string* outUsersAnswer);
-
- Description: Prompts the user to enter some data.
- Parameters: inQuestion - message to display to the user.
- inDefaultAnswer - a default input.
- outUsersAnswer - input the user entered. Only valid if user did
- not cancel.
- Returns: 1 = user cancelled, 0 = user did not cancel.
-
- Example: string outUsersAnswer;
- if (MICI.Ask("Please enter an amount:", "50", &outUsersAnswer) == 1)
- printf("User cancelled.");
-
- -----------------------------
-
- int = Answer(string inQuestion [, string inOKButtonTxt, string inCancelButtonTxt]);
-
- Description: Prompts the user, and waits for an answer (eg OK or cancel).
- Parameters: inQuestion - message to display to the user.
- inOKButtonTxt - optional, override the default "OK" text.
- inCancelButtonTxt - optional, override the default "cancel" text.
- Returns: 1 = user hit "cancel", 0 = user hit "OK".
-
- Example: int reply;
- reply = MICI.Answer("Is it wet outside?", "Yes", "No");
- if (reply == 0)
- printf("User pressed Yes");
-
- -----------------------------
-
- int = SetFileTypeCreator(struct inSpec, string inType, string inCreator);
- int = SetFileTypeCreator(string inPath, string inType, string inCreator);
-
- Description: Sets the Type/Creator of a specificed file.
- Parameters: inSpec - a valid FSSpec.
- inPath - a path to a file.
- inType - 4 char type ID.
- inCreator - 4 char creator ID.
- Returns: returns any errors that occured or zero for no error.
-
- Example: int err = MICI.SetFileTypeCreator("HD:report.txt", "TEXT", "ttxt");
-
- -----------------------------
-
- int = OpenObject(struct inSpec [, string inCreator]);
- int = OpenObject(string inPath [, string inCreator]);
-
- Description: Opens a file/folder using the specified application.
- Parameters: inSpec - a valid FSSpec.
- inPath - a path to a file/folder.
- inCreator - optional, creator ID of application to open the
- specified file/folder. Defaults to "MACS" which is
- the Finder.
- Returns: returns any errors that occured or zero for no error.
-
- NOTE: This routine assumes the process/application you specify
- to open the object is currently running.
-
- Example: int err = MICI.OpenObject("HD:report.txt", "ttxt");
- /* opens a file called report.txt using SimpleText */
-
- -----------------------------
-
- int = ExecuteScript(string inAppleScript);
-
- Description: Executes a string of apple script.
- Parameters: inAppleScript - AppleScript to execute.
- Returns: returns any errors that occured or zero for no error.
-
- Example: auto myScript = "tell application \"Finder\"\r"
- " open file \"HD:report.txt\"\r"
- "end tell";
-
- int err = MICI.ExecuteScript(myScript);
-
-
- -----------------------------
-
- int = OSType(string inType);
-
- Description: OSType("TEXT") returns 'TEXT' as a int.
- Parameters: inType - type string to convert to int.
- Returns: int value of inType
-
- Example: int type = MICI.OSType("TEXT");
-
- -----------------------------
-